package com.uzai.console.web.sys;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.annotation.SystemLogType;
import com.uzai.console.dto.sys.sensitiveword.SensitiveWordDto;
import com.uzai.console.enums.OperationTypeEnum;
import com.uzai.console.enums.SystemModelEnum;
import com.uzai.console.service.sys.SensitiveWordService;
import com.uzai.console.vo.sys.sensitiveword.SensitiveWordVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liuqi
 * @date 2021年09月11日 20:15
 */
@Api(value = "敏感词设置",tags = "敏感词设置")
@ApiSort(30)
@RestController
public class SensitiveWordController extends BaseController {

    @Autowired
    private SensitiveWordService sensitiveWordService;

    @ApiOperation(value = "查询敏感词设置信息", notes = "查询敏感词设置信息", response = SensitiveWordVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/sensitiveWord/find")
    public Object findSensitiveWordInfo(){
        return sensitiveWordService.findSensitiveWordInfo(getLoginInfo().getMerId());
    }

    @SystemLogType(model = SystemModelEnum.SensitiveWord, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "保存敏感词设置信息", notes = "保存敏感词设置信息")
    @ApiOperationSupport(order = 2)
    @PostMapping("/sensitiveWord/update")
    public Object updateSensitiveWord(@RequestBody SensitiveWordDto sensitiveWordDto){
        sensitiveWordService.updateSensitiveWord(sensitiveWordDto);
        return true;
    }
}
